package com.yixun.qfbao.hander;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yixun.qfbao.api.service.PersonnelService;
import com.yixun.qfbao.apidto.GetPartnerDetailReqDto;
import com.yixun.qfbao.apidto.GetPartnerDetailResDto;
import com.yixun.qfbao.dto.base.BaseRequestDTO;
import com.yixun.qfbao.dto.base.BaseResponseDTO;
import com.yixun.qfbao.hander.base.CommonAbstractHander;
import com.yixun.qfbao.vo.GetPartnerDetailReqVo;
import com.yixun.qfbao.xf.model.enums.ResultEnum;

/**
 * @Description
 * @Date 2017/12/5
 * @Author JHSong
 * @Computer Administrator
 */
@Service("getPartnerDetailHander")
public class GetPartnerDetailHander extends CommonAbstractHander {
    private static Logger logger= LoggerFactory.getLogger(GetPartnerDetailHander.class);
    @Autowired
    PersonnelService personnelService;
    @Override
    public BaseResponseDTO doBusiness(BaseRequestDTO reqDto) {
        GetPartnerDetailReqVo req = (GetPartnerDetailReqVo)reqDto;
        GetPartnerDetailReqDto GetPartnerDetailReqDto = req.getParams();
        BaseResponseDTO<GetPartnerDetailResDto> res = new BaseResponseDTO<GetPartnerDetailResDto>();
        GetPartnerDetailResDto resDto = new GetPartnerDetailResDto();
        try{
            resDto = personnelService.getPartnerDetail(GetPartnerDetailReqDto);
        } catch (Exception e) {
            logger.error("GetPartnerDetailHander error: {}", e);
            resDto.setResult(ResultEnum.FAIL.getNo());
            resDto.setResultMsg("实时获取用户信息失败");
        }
        res.setResData(resDto);
        res.setResult(resDto.getResult());
        return res;
    }
}
